package com.jiang.smartcommunity.ui.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.jiang.smartcommunity.MainActivity;
import com.jiang.smartcommunity.R;
import com.jiang.smartcommunity.tool.MyAdapter;

import java.util.Arrays;
import java.util.List;

public class S2DActivity extends BaseActivity {


    private RecyclerView rv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_s2_d);
        initView();
        setTitle("包裹信息");

    }

    private void initView() {
        rv = (RecyclerView) findViewById(R.id.rv);
        rv.setLayoutManager(new LinearLayoutManager(getThis()));
        List<MainActivity.NotifyBean> notifyBeans = Arrays.asList(
                new MainActivity.NotifyBean("已经代签的包裹", "34-4535", R.drawable.a1),
                new MainActivity.NotifyBean("已经代签的包裹", "67-2342", R.drawable.a3),
                new MainActivity.NotifyBean("已经代签的包裹", "45-4535", R.drawable.a6),
                new MainActivity.NotifyBean("已经代签的包裹", "94-4435", R.drawable.a4));
        rv.setAdapter(new MyAdapter<MainActivity.NotifyBean>(getThis(), R.layout.item_kuaidi, notifyBeans) {
            private ImageView imageView6;
            private TextView textView9;
            private TextView tvCall;
            private TextView textView11;

            @Override
            public void init(View root, int position) {
                imageView6 = (ImageView) root.findViewById(R.id.imageView6);
                textView9 = (TextView) root.findViewById(R.id.textView9);
                tvCall = (TextView) root.findViewById(R.id.tv_call);
                textView11 = (TextView) root.findViewById(R.id.textView11);
                MainActivity.NotifyBean item = getItem(position);
                imageView6.setImageResource(item.res);
                textView11.setText(item.c);
                textView9.setText(item.t);
                tvCall.setOnClickListener(v -> {
                    startActivity(new Intent(getThis(), CodeActivity.class));
                });
            }
        });
    }
}